#include "Object.h"



Object::Object(char * n = "undefined")
{
	parent = NULL;
	name = n;
}


Object::~Object(void)
{
}

char * Object::GetName()
{
	return name;
}

void Object::debugRender()
{
	
}

Object* Object::getChildByName(char * name)
{
	std::string sname = name;
	for(Object* &o : children)
	{
		std::string oname = o->GetName();

		if(sname == oname)
			return o;
	}

	return NULL;
}



void Object::renderToFrameBuffer()
{
}

void Object::addChild(Object* o)
{
	children.push_back(o);
	o->parent = this;
}

void Object::removeChild(Object* o)
{
	//children.erase(std::find(std::begin(children), std::end(children), &o));
}

int Object::getChildCount()
{
	return children.size();
}

int Object::getRecursiveChildCount()
{
	int finalCount = children.size();
	for(Object* &o : children)
	{
		finalCount += o->getChildCount();
	}
	return finalCount;
}